import 'dart:convert';

import 'package:http/http.dart' as http;

import '../model/traveltab_model.dart';

//旅拍类别接口
class TravelTabDao{
  static Future<TravelTabModel> fetch() async{
    Uri uri = Uri.parse('http://www.devio.org/io/flutter_app/json/travel_page.json');
    final response = await http.get(uri);
    if(response.statusCode == 200){
      Utf8Decoder utf8decoder = Utf8Decoder();
      var result = json.decode(utf8decoder.convert(response.bodyBytes));//解决中文乱码
      return TravelTabModel.fromJson(result);
    }else{
      throw Exception('请求旅拍tab失败');
    }
  }
}